home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK2.toast / Development Kits (Disc 2) / ScriptX / Code Samples / autofind / media / mkmodels.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  2.4 KB  |  54 lines  |  [TEXT/ttxt]

  1. --<<<-
  2. -- Build group of title containers, each holding one graphable ModelCar.
  3. -- (These should really be accessory containers instead, but we want to
  4. -- be able to load them into the KMP externally, and in ScriptX V1.0,
  5. -- that can only be achieved with title containers.)
  6.  
  7. global scriptDir := theScriptDir
  8. global titleDir := parentDir theScriptDir
  9. global theMediaDir := spawn scriptDir "modCars"
  10.  
  11. -- Make the StorageContainer for the car database.
  12. global theLib := new LibraryContainer \
  13.     dir:titleDir \
  14.     path: "models.sxl" \
  15.     mode:@create \
  16.     targetCollection:(new HashTable)
  17.  
  18. global database := new Array
  19. append database #("achieva", #(16321, 14120, 14.4, 20, "4-Door Sedan",  24, 150,  9000, 26, 1994, "Achieva",        161, 12.4))
  20. append database #("acura", #(22319, 21090, 11.4, 23, "Coupe",         28, 150, 11000, 30, 1994, "Acura Legend",   110, 8.4))
  21. append database #("civic", #(17213, 16213, 10.4, 25, "2-Door Sedan",  30, 120,  9000, 32, 1994, "Honda Civic",    131, 11.4))
  22. append database #("corolla", #(16121, 15049,  9.0, 22, "Coupe",         28, 140, 10000, 30, 1994, "Toyota Corolla", 140, 12.4))
  23. append database #("jeep", #(21399, 18231, 19.9, 17, "Sport-Utility", 21, 230, 14000, 23, 1994, "Jeep Cherokee",  152, 12.4))
  24. append database #("miata", #(16281, 15823,  5.9, 22, "Sports Car",    27, 220, 11000, 29, 1994, "Mazda Miata",    123, 9.0))
  25. append database #("trooper", #(24872, 22357, 19.4, 15, "Sport-Utility", 20, 190, 14000, 22, 1994, "Isuzu Trooper",  161, 11.7))
  26. append database #("rx7", #(18120, 17132,  5.1, 21, "Sports Car",    27, 270, 12000, 29, 1994, "Maxda RX7",      103, 7.5))
  27. append database #("probe", #(16400, 15873,  8.2, 23, "Sports Car",    29, 120, 11000, 30, 1994, "Ford Probe",     120, 8.9))
  28. append database #("bmw", #(29310, 26912, 14.4, 21, "2-Door Sedan",  26, 340, 20000, 28, 1994, "BMW 325i",       117, 9.0))
  29.  
  30. -- Create title containers for each car.
  31. for obj in database do
  32. (
  33.     local objName := obj[1]
  34.     local objProperties := obj[2]
  35.  
  36.     -- Get the graphic for the object.
  37.     local media := new KeyedLinkedList
  38.     local fileName := objName + ".bmp"
  39.     local theStream := getStream theMediaDir fileName @readable
  40.     local thumbnail := importMedia theImportExportEngine theStream \
  41.         @image @dib @bitmap
  42.     thumbnail.invisiblecolor := whitecolor
  43.     append objProperties thumbnail
  44.  
  45.     -- Create the object.
  46. --    local obj := apply makeModelCar ModelCar objProperties
  47.  
  48. )
  49. add theLib @data database
  50. close theLib
  51.  
  52. "Compiled mkModcars.sx"
  53. -->>>
  54.